package com.twu.biblioteca;

public class User {

    private String name;
    private String email;
    private String phone;
    private String username;
    private String password;

    public void setLogin(boolean login) {
        this.login = login;
    }

    private boolean login;


    public String getUsername() {
        return username;
    }

    public String[] getInfo() {
        return new String[]{name, email, phone};
    }

    public boolean isLogin() {
        return login;
    }

    public void setInfo(String[] info) {
        name = info[0];
        email = info[1];
        phone = info[2];
    }


    public User(String name, String email, String phone, String username, String password) {
        this.name = name;
        this.email = email;
        this.phone = phone;
        this.username = username;
        this.password = password;
        this.login = false;
    }

    public String toString() {
        return "Name: " + name + "\n" + "E-mail: " + email + "\n" + "Phone#: " + phone + "\n";
    }

    public boolean validatePassword(String password) {
        if (this.password.equals(password)) {
            System.out.println("Successfully login!");
            login = true;
            return true;
        } else {
            System.out.println("Invalid password!");
            login = false;
            return false;
        }
    }
}
